package com.stx.common;

import com.stx.pojo.Player;

import javax.websocket.Session;
import java.util.concurrent.ConcurrentHashMap;

public class PlayerSessionUtil {

    private static  ConcurrentHashMap<Integer, Session> sessionMap = new ConcurrentHashMap<>();

    public static void addPlayerSession(int playerId, Session session) {
        sessionMap.put(playerId, session);
    }

    public static Session getPlayerSession(int playerId) {
        return sessionMap.get(playerId);
    }

    public static void removePlayerSession(int playerId) {
        sessionMap.remove(playerId);
    }
}
